package shg.book.util
{
	import com.shuhg.bean.BookBean;
	
	import mx.controls.Image;

	//边框颜色     
	[Style(name="borderColor", type="uint", format="Color", inherit="no")]     
	//边框宽度     
	[Style(name="borderWidth", type="Number", format="Length", inherit="no")]     
	//边框透明度     
	[Style(name="borderAlpha", type="Number", format="Length", inherit="no")] 
	
	public class BorderImage extends Image
	{
		public var contentText:String;
		//批注的类型1，2，3，4
		public var type:int;
		//颜色值
		public var colorValue:Number;
		//索引值
		public var indexValue:Number;
		//背景颜色透明值
		public var alphaValue:Number=0.5;
		//展示在桌面的数据需要下面的特性
		public var bookBean:BookBean;
		
		public function BorderImage()
		{
			super();
		}
		override protected function updateDisplayList(w:Number, h:Number):void{     
			super.updateDisplayList(w,h);     
			graphics.clear();     
			
			graphics.lineStyle(getStyle('borderWidth'),getStyle('borderColor'),getStyle('borderAlpha'),false);     
			
			var x:Number=-(getStyle('borderWidth')/2);     
			var y:Number=-(getStyle('borderWidth')/2);     
			var width:Number=contentWidth+getStyle('borderWidth');     
			var height:Number=contentHeight+getStyle('borderWidth');     
			graphics.drawRect(isNaN(x)?0:x,isNaN(y)?0:y,isNaN(width)?0:width,isNaN(height)?0:height);             
		}
		public function updateStyleList(Color:uint,Width:Number,Alpha:Number):void{
			setStyle("borderColor",Color);
			setStyle("borderWidth",Width);
			setStyle("borderAlpha",Alpha);
		}
	}
}